﻿using System;
using System.Net;

namespace SCG.SolarVengeanceEngine.StarShips
{
    //Base class for StarShips that can carry Resources
    public abstract class ResourceStarShip : StarShip
    {
        //constructor
        public ResourceStarShip(SVGame game, Player owner, int engines, int extra, StarSystem origin)
            : base(game, owner, engines, extra, origin)
        {
        }

        //Resources
        public double Resources { get; set; }

        public int ResourcesInt
        {
            get
            {
                return (int)Resources;
            }
        }

        //can it serve as a transport source?
        public virtual bool IsTransportSource
        {
            get
            {
                return false;
            }
        }

        //can it serve as a transport destination?
        public virtual bool IsTransportDestination
        {
            get
            {
                return false;
            }
        }
       
        //Persistence
        protected override string SubClassPersist()
        {
            SVTokenizer tok = new SVTokenizer(Game);
            tok.Tokenize(Resources);
            return tok.Result;
        }
        protected override void SubClassParse(SVTokenizer tok)
        {
            Resources = tok.TokenDouble;
        }
    }
}
